#ifndef PT_SYSTEM_TASKSCHEDULER_H
#define PT_SYSTEM_TASKSCHEDULER_H

#include"PTSMemoryAllocator.h"

struct PTTask
{

};

struct IPTSTaskScheduler
{
	virtual void Destruct() = 0;

	inline void Destory(IPTSHeap *pHeap)
	{
		this->Destruct();
		pHeap->AlignedFree(this);
	}

	virtual void SpawnRootAndWait(PTTask *pFirst, PTTask *pNext) = 0;
};

struct alignas(alignof(uintptr_t)) PTSTaskSchedulerStorage
{
	char _Pad[sizeof(uintptr_t)];
};

extern "C" PTSYSTEMAPI IPTSTaskScheduler * PTCALL PTSTaskScheduler_Construct(PTSTaskSchedulerStorage *pStorage);

inline IPTSTaskScheduler * PTCALL PTSTaskScheduler_Create(IPTSHeap *pHeap)
{
	PTSTaskSchedulerStorage *pStorage = static_cast<PTSTaskSchedulerStorage *>(pHeap->AlignedAlloc(sizeof(PTSTaskSchedulerStorage), alignof(PTSTaskSchedulerStorage)));
	return (pStorage != NULL) ? ::PTSTaskScheduler_Construct(pStorage) : NULL;
};

#endif